package edu.egypt.timepickersample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;

public class TimePickerSampleActivity extends Activity {
	
    private TimePicker timePicker;
	private Button button;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        intializeUI();
    }

	private void intializeUI() {

		timePicker = (TimePicker)findViewById(R.id.timePicker1);
		button = (Button)findViewById(R.id.button1);
		button.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String timeSelected = "Time:"+timePicker.getCurrentHour()+":"+timePicker.getCurrentMinute();
				Toast.makeText(TimePickerSampleActivity.this, timeSelected, Toast.LENGTH_SHORT).show();
			}
		});
		
	}
}